package com.shawn.jetpackstady.room.bean;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;


@Entity
public  class User {
    // 主键 自增长
    @PrimaryKey(autoGenerate = true)
    private int userID;

    @ColumnInfo
    private String Name;

    // 忽略这个字段 在对应的表中不会生成列
    @Ignore
    private String sex;

    @ColumnInfo(defaultValue = "中国")
    private String country;

    public int getUserID() {
        return userID;
    }

    public void setUserID(int userID) {
        this.userID = userID;
    }

    public String getName() {
        return Name;
    }

    public void setName(String name) {
        Name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"userID\":")
                .append(userID);
        sb.append(",\"Name\":\"")
                .append(Name).append('\"');
        sb.append(",\"sex\":\"")
                .append(sex).append('\"');
        sb.append(",\"country\":\"")
                .append(country).append('\"');
        sb.append('}');
        return sb.toString();
    }
}
